package cn.lingyangwl.agile.pay.pay.controller.refund;

import cn.lingyangwl.agile.pay.common.annotation.PayCheck;
import cn.lingyangwl.framework.core.response.Resp;
import cn.lingyangwl.agile.pay.model.rqrs.pay.refund.RefundOrderRQ;
import cn.lingyangwl.agile.pay.validation.PaySignGroup;
import cn.lingyangwl.agile.pay.pay.process.refund.RefundOrderProcess;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 商户发起退款 controller
 *
 * @author shenguangyang
 */
@Slf4j
@RestController
@RequestMapping("/pay/refund")
public class RefundOrderController {
    @Resource
    private RefundOrderProcess refundOrderProcess;

    /**
     * 申请退款
     */
    @PostMapping("/refundOrder")
    @PayCheck
    public Resp<?> refundOrder(@RequestBody @Validated(value = PaySignGroup.class) RefundOrderRQ rq) {
        return refundOrderProcess.refundOrder(rq);
    }

}
